<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>个人信息</title>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#inputForm").validate({
				submitHandler: function(form){
					form.submit();
				},
				errorClass: 'validation-invalid-label',
				highlight: function(element, errorClass) {
					$(element).removeClass(errorClass);
				},
				errorPlacement: function (error, element) {
					validateErrorPlacement(error, element);
				}
			});
		});
	</script>
</head>
<body>
<div class="content">
	<sys:message content="${message}"/>
	<div class="row">
		<div class="col-sm-6">
			<div class="card m-0 border-0">
				<div class="card-body">
					<form:form id="inputForm" method="post"
							   modelAttribute="user" action="${ctxAdmin}/sys/user/info" >
						<div class="form-group row">
							<label class="col-sm-3 col-form-label">归属公司</label>
							<div class="col-sm-9">
								<label class="form-control-plaintext">${user.company.name}</label>
							</div>
						</div>
						<div class="form-group row">
							<label class="col-sm-3 col-form-label">归属部门</label>
							<div class="col-sm-9">
								<label class="form-control-plaintext">${user.office.name}</label>
							</div>
						</div>
						<div class="form-group row">
							<label class="col-sm-3 col-form-label">用户姓名</label>
							<div class="col-sm-9">
								<label class="form-control-plaintext">${user.name}</label>
							</div>
						</div>
						<div class="form-group row">
							<label class="col-sm-3 col-form-label">登录账号</label>
							<div class="col-sm-9">
								<label class="form-control-plaintext">${user.loginName}</label>
							</div>
						</div>
						<div class="form-group row">
							<label class="col-sm-3 col-form-label">用户角色</label>
							<div class="col-sm-9">
								<label class="form-control-plaintext">
									<c:forEach items="${fn:split(user.roleNames,',')}" var="roleName" >
										<button type="button" class="btn alpha-primary text-primary-800 btn-icon"><i class="mi-lens mr-2"></i>${roleName}</button>
									</c:forEach>
								</label>
							</div>
						</div>
						<div class="form-group row">
							<label class="col-sm-3 col-form-label">上次登录</label>
							<div class="col-sm-9">
								<label class="form-control-plaintext">IP: ${user.oldLoginIp}&nbsp;&nbsp;&nbsp;&nbsp;时间：<fmt:formatDate value="${user.oldLoginDate}" type="both" dateStyle="full"/></label>
							</div>
						</div>
					</form:form>
				</div>
			</div>
		</div>
		<div class="col-sm-6">
			<div class="card m-0 border-0">
				<div class="card-body">
					<form:form id="inputForm" method="post"
							   modelAttribute="user" action="${ctxAdmin}/sys/user/info" >

						<div class="form-group row">
							<label class="col-sm-3 col-form-label">证件类型</label>
							<div class="col-sm-9">
								<form:select path="credentialType" class="form-control required">
									<form:options items="${fns:getDictList('credential_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
								</form:select>
							</div>
						</div>
						<div class="form-group row">
							<label class="col-sm-3 col-form-label">证件编号</label>
							<div class="col-sm-9">
								<form:input path="credentialNo" htmlEscape="false" maxlength="100" cssClass="form-control required"/>
							</div>
						</div>

						<div class="form-group row">
							<label class="col-sm-3 col-form-label">用户性别</label>
							<div class="col-sm-9">
								<form:select path="sex" class="form-control required">
									<form:options items="${fns:getDictList('sex')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
								</form:select>
							</div>
						</div>
						<div class="form-group row">
							<label class="col-sm-3 col-form-label">电子邮箱</label>
							<div class="col-sm-9">
								<form:input path="email" htmlEscape="false" maxlength="100" cssClass="email form-control"/>
							</div>
						</div>
						<div class="form-group row">
							<label class="col-sm-3 col-form-label">电话号码</label>
							<div class="col-sm-9">
								<form:input path="phone" htmlEscape="false" maxlength="100" cssClass="form-control"/>
							</div>
						</div>
						<div class="form-group row">
							<label class="col-sm-3 col-form-label">手机号码</label>
							<div class="col-sm-9">
								<form:input path="mobile" htmlEscape="false" maxlength="100" cssClass="form-control"/>
							</div>
						</div>

						<div class="form-group row">
							<label class="col-sm-3 col-form-label">用户类型:</label>
							<div class="col-sm-9">
								<select name="userType" class="multiselect" multiple="multiple">
									<c:forEach items="${fns:getDictList('sys_user_type')}" var="dict" >
										<option value="${dict.value}" ${fn:contains(user.userType,dict.value) ? 'selected':''}>${dict.label}</option>
									</c:forEach>
								</select>
							</div>
						</div>
						<div class="form-group row mb-0">
							<div class="col-sm-9 ml-sm-auto">
								<button type="submit" class="btn btn-primary"><i class="icon-database-check mr-2"></i>保 存</button>
							</div>
						</div>
					</form:form>
				</div>
			</div>
		</div>
	</div>
</div>

</body>
</html>